<?php
	require_once("includes/overhead.php");
		$query="select  D.Code as Department, C.ID as ID, Number as CourseNumber from Course as C join Department as D on C.DepartmentID=D.ID ";
		if (isset($_REQUEST['Department'])) {
			$query.=" where D.Code='".mysql_real_escape_string($_REQUEST['Department'])."'";
		
		}
		$query.=" order by D.Code, C.Number";
		$courses=null;
		$getCourseListQuery=mysql_query($query);
		header ("Content-Type:text/xml"); 
		print "<Courses>\n";
		while ($row=mysql_fetch_assoc($getCourseListQuery)) { 
			print "<Course>\n<DepartmentCode>".$row['Department']."</DepartmentCode>\n<CourseNumber>".$row['CourseNumber']."</CourseNumber>\n</Course>\n";
		}
		print "</Courses>";


?>